<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>浅拷贝</title>
</head>
<body>
    <script>
    function clone(target){
        let res = {}
        for(const key in target){
            res[key] = target[key]
        }
        return res
    }

    let person1 = {name:'kizzy',age:22,sex:'male'}
    let person2 = clone(person1)
    person1.name='lin'
    console.log('person1:',person1)
    console.log('person2:',person2)
</script>
</body>
</html>